var push = require('./utils/pushsdk.js');
var api = require('utils/api.js');
App({
  globalData: {
    userInfo: '',
    systemInfo: null,
    erweima: '',
    gloabalFomIds: null,
    upload: 'https://bn.heze123.cn/sdupdate/szufu/',
    imgUrl: "https://bn.heze123.cn/public/upload/"
    // imgUrl: "http://localhost/jierizhufu/public/upload/"
  },
  onLaunch: function () {
    this.getUserInfo();
  },
  getUserInfo: function (cb) {
    var that = this
    if (this.globalData.userInfo) {
      typeof cb == "function" && cb(this.globalData.userInfo)
    } else {
      //调用登录接口
      wx.login({
        success: function (res) {
          wx.getUserInfo({
            success: function (res) {
              that.globalData.userInfo = res.userInfo
              typeof cb == "function" && cb(that.globalData.userInfo)
            }
          })
        }
      })
    }
  },
  getSystemInfo: function (cb) {
    var that = this
    if (that.globalData.systemInfo) {
      typeof cb == "function" && cb(that.globalData.systemInfo)
    } else {
      wx.getSystemInfo({
        success: function (res) {
          that.globalData.systemInfo = res
          typeof cb == "function" && cb(that.globalData.systemInfo)
        }
      })
    }
  },

  pagesData: {},
  pagesNeedUpdate: {},
})